
$.fn.serializeJson = function() {
	var serializeObj = {};
	var array = this.serializeArray();
	var str = this.serialize();
	$(array).each(
			function() {
				if (serializeObj[this.name]) {
					if ($.isArray(serializeObj[this.name])) {
						serializeObj[this.name].push(this.value);
					} else {
						serializeObj[this.name] = [ serializeObj[this.name],
								this.value ];
					}
				} else {
					serializeObj[this.name] = this.value;
				}
			});
	return serializeObj;
};

function opendlg(title, src) {
	$.layer({
		type : 2,
		title : title,
		shade : [ 0.5 ], // 涓嶆樉绀洪伄缃�
		area : [ '400px', '200px' ],
		offset : [ '100px', '' ],
		iframe : {
			src : src
		}
	});
}

function doSaveSubmit(url, data, refreshbtnname) {
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		url : url,// 璇锋眰鐨刟ction璺緞
		data : data,
		error : function() {// 璇锋眰澶辫触澶勭悊鍑芥暟
			parent.layer.msg('请求失败');
		},
		success : function() {
			parent.layer.msg('请求成功', 1, -1);
			$(refreshbtnname, parent.document).click();
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	});
}

function doConfirmSubmit(url, refreshbtnname) {
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		url : url,// 璇锋眰鐨刟ction璺緞
		// data: data,
		error : function() {// 璇锋眰澶辫触澶勭悊鍑芥暟
			layer.msg('请求失败');
		},
		success : function() {
			layer.msg('请求成功', 1, -1);
			$(refreshbtnname).click();
		}
	});
}

function confirmdlg(content, url, refreshbtnname) {
	layer.confirm(content, function() {
		doConfirmSubmit(url, refreshbtnname);
	});
}